package dlldynamicset;

public class DLLNode<E, K extends Comparable<K>> implements Comparable<DLLNode<E, K>>
{
	private E data;
	// Need to implement key
	private K key;
	private DLLNode<E, K> next;
	private DLLNode<E, K> previous;
	
	
	/**
	*	Constructor to create a node with a given datatype
	*/
	public DLLNode(E datavalue, K keyvalue)
	{
		data = datavalue;
		// Initialize key
		key = keyvalue;
		next = null;
		previous = null;
	}
	
	public DLLNode
		(E datavalue, K keyvalue, DLLNode<E, K> nextNode, DLLNode<E, K> previousNode)
	{
		data = datavalue;
		// Initialize key
		key = keyvalue;
		next = nextNode;
		previous = previousNode;
	}
	
	public DLLNode<E, K> getNext()
	{
		return next;
	}
	
	public DLLNode<E, K> getPrevious()
	{
		return previous;
	}
	
	public void setNext(DLLNode<E, K> node)
	{
		next = node;
	}
	
	public void setPrevious(DLLNode<E, K> node)
	{
		previous = node;
	}
	
	public K getKey()
	{
		return key;
	}
	
	
	public E getData()
	{
		return data;
	}
	
	public String toString()
	{
		return key.toString();
	}
	
	public int compareTo(DLLNode<E, K> anotherRecord)
	{
		return this.key.compareTo(anotherRecord.getKey());
	}
}